<template>
	<view class="content">
		<uni-collapse accordion="true">
		    <uni-collapse-item title="删除大赛通知" thumb="../../static/shanchu.png">
				<uni-swipe-action style="border: 1px solid #ccc;padding-left: 10px;background-color: #fff;" v-for="(item,index) in message" :key="item.id">
					<uni-swipe-action-item v-for="(it,idx) in swipeList" :options="it.options" :key="it.id" @change="swipeChange" @click="swipeClick(item.id,index)">
						<text class="cont" style="margin-right: 5px;">{{index+1}}.</text><text class="cont">{{item.title}}</text>
					</uni-swipe-action-item>
				</uni-swipe-action>
		    </uni-collapse-item>
		</uni-collapse>
	</view>
</template>

<script>
	import uniCollapse from '../../components/uni-collapse/uni-collapse.vue'
	import uniCollapseItem from '../../components/uni-collapse-item/uni-collapse-item.vue'
	import uniSection from '../../components/uni-section/uni-section.vue'
	export default{
		data(){
			return{
				delectList:{
					id:'',
					index:''
				},
				swipeList: [
					{id: 1,
					options: [{
						text: '删除',
						style: {backgroundColor: 'rgb(255,58,49)'}
					}],
				}]
			}
		},
		methods:{
			swipeChange(e) {
				console.log('返回：', e);
			},
			swipeClick(id,index) {
				uni.showModal({
					title: '提示',
					content: '是否删除',
					success: (res) => {
						if (res.confirm) {
							this.delectList.id = id
							this.delectList.index = index
							this.$emit('func',JSON.stringify(this.delectList))
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
		},
		 props: ["message"],
		components:{uniCollapse,uniCollapseItem,uniSection}
	}
</script>

<style lang="scss" scoped>
	view{
		width: 100%;
		font-size: 14px;
		text-align: left;
		background-color: #fff;
		// border-bottom: 2px solid #DDDDDD;
		line-height: 40px;
		button{
			width: 50%;
			font-size: 12px;
			background-color: #CCE6FF;
			margin: 10px auto;
		}
		input{
			width: 60%;
			border: 2px solid #CCE6FF;
			font-size: 12px;
			margin: 5px auto;
		}
		
	}
</style>
